<?php
/**
 * 
 * Install script that adds the admin user and
 * some permissions for it so that more users
 * can be added
 * 
 * @category Abovo
 * 
 * @package Abovo
 * 
 * @author Antti Holvikari <anttih@gmail.com>
 * 
 */

include 'Solar.php';

Solar::start(dirname(__FILE__) . '/Abovo.config.php');

// insert to authentication credentials
$auth = Solar::factory('Abovo_Model_Auth');
$auth->insert(array(
    'handle'   => 'admin',
    'password' => 'solarmagic',
));

// add admin user to contacts
$users = Solar::factory('Abovo_Model_Contacts_Users');
$users->insert(array(
    'firstname' => 'Administrator',
    'lastname'  => 'Admin',
    'handle'    => 'admin',
    'gender'    => 1,
    'email'     => 'admin@example.com',
    'country'   => 'FI',
));


// grant some permissions
$perms = Solar::factory('Abovo_Model_Perms');
$perms->grant('admin', 'Abovo_App_System_Perms', 'browse');
$perms->grant('admin', 'Abovo_App_System_Perms', 'permissions');
$perms->grant('admin', 'Abovo_App_System_Perms', 'invitations');

Solar::stop();
?>
